import pymysql

db = pymysql.connect('127.0.0.1', 'root', '123456', 'study')
cursor = db.cursor()
# cursor.execute('select version()')
cursor.execute('drop table if exists books')
sql = '''
CREATE TABLE books(
    id int(8) not null auto_increment,
    name varchar(50) not null,
    category varchar(50) not null,
    price decimal(10,2) default null,
    publish_time date default null,
    primary key(id)
) engine=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
'''
cursor.execute(sql)
# data = cursor.fetchone()
# print("Database Version:{}".format(data))
db.close()
